#!/bin/sh
# this is a test script and is NOT ready to be used with ait

# Set the file to watch
opts_file="/tmp/.ait_lsp_options"

# Get the initial modification time
init_time=$(stat -f %m "$opts_file")

echo "$@" > /tmp/.ait_lsp_cmd

while true; do
    cur_time=$(stat -f %m "$opts_file")
    if [ "$cur_time" != "$init_time" ]; then
        obj=`cat $opts_file | pick | awk -F'\t' '{print $2}'`

        lua %%SHAREDIR%%/lsp-extract.lua "$obj"

        break
    fi
    sleep 1
done
